process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';

import './utils/ipc';
import './utils/global';
import { config } from './config';
import { createWindow } from './createWindow';
import { menuTemplate } from './utils/menuTemplate';
import { app, BrowserWindow, Menu } from 'electron';

Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));

app.whenReady().then(() => {
	if (config.isProEnv()) {
		createWindow(process.argv[1]);
	} else {
		createWindow();
	}

	app.on('activate', () => {
		if (BrowserWindow.getAllWindows().length === 0) {
			createWindow();
		}
	});
});

app.on('window-all-closed', () => {
	if (process.platform !== 'darwin') {
		app.quit();
	}
});
